package com.kermel.common.util;

import junit.framework.TestCase;

public class StringUtilsTest extends TestCase {
    public static final String SPACE_STRING_FIXTURE = " ";
    public static final String NO_WHITESPACE_FIXTURE = "12345";
    public static final String SOME_WHITESPACE_FIXTURE = "123 456\t678\n90\r1";
    public static final String ONLY_WHITESPACE_FIXTURE = " \t\n\r";
    
    protected void setUp() throws Exception {
        super.setUp();
    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }
    
    public void testThatSpaceIsNotNull() {
        assertNotNull(StringUtils.SPACE);
    }
    
    public void testThatSpaceContainsOnlyOneSpaceCharacter() {
        assertEquals(SPACE_STRING_FIXTURE, StringUtils.SPACE);
    }
    
    public void testThatIsEmptyReturnsTrueForNullString() {
        boolean result = StringUtils.isEmpty(null);
        assertTrue(result);
    }
    
    public void testThatIsEmptyReturnsTrueForEmptyString() {
        boolean result = StringUtils.isEmpty(StringUtils.EMPTY);
        assertTrue(result);
    }
    
    public void testThatIsEmptyReturnsFalseForNonNullNonEmptyString() {
        boolean result = StringUtils.isEmpty(StringUtils.SPACE);
        assertFalse(result);
    }
    
    public void testThatIsNotEmptyReturnsFalseForNullString() {
        boolean result = StringUtils.isNotEmpty(null);
        assertFalse(result);
    }
    
    public void testThatIsNotEmptyReturnsFalseForEmptyString() {
        boolean result = StringUtils.isNotEmpty(StringUtils.EMPTY);
        assertFalse(result);
    }
    
    public void testThatIsNotEmptyReturnsTrueForNonNullNonEmptyString() {
        boolean result = StringUtils.isNotEmpty(StringUtils.SPACE);
        assertTrue(result);
    }
    
    public void testThatIsWhitespaceReturnsFalseForNullString() {
        boolean result = StringUtils.isWhitespace(null);
        assertFalse(result);
    }
    
    public void testThatIsWhitespaceReturnsTrueForEmptyString() {
        boolean result = StringUtils.isWhitespace(StringUtils.EMPTY);
        assertTrue(result);
    }
    
    public void testThatIsWhitespaceReturnsFalseForStringWithNoWhitespaceCharacters() {
        boolean result = StringUtils.isWhitespace(NO_WHITESPACE_FIXTURE);
        assertFalse(result);
    }
    
    public void testThatIsWhitespaceReturnsFalseForStringWithSomeWhitespaceCharacters() {
        boolean result = StringUtils.isWhitespace(SOME_WHITESPACE_FIXTURE);
        assertFalse(result);
    }
    
    public void testThatIsWhitespaceReturnsTrueForStringContainingOnlyWhitespaceCharacters() {
        boolean result = StringUtils.isWhitespace(ONLY_WHITESPACE_FIXTURE);
        assertTrue(result);
    }
    
    public void testThatIsBlankReturnsTrueForNullString() {
        boolean result = StringUtils.isBlank(null);
        assertTrue(result);
    }
    
    public void testThatIsBlankReturnsTrueForEmptyString() {
        boolean result = StringUtils.isBlank(StringUtils.EMPTY);
        assertTrue(result);
    }
    
    public void testThatIsBlankReturnsFalseForStringWithNoWhitespaceCharacters() {
        boolean result = StringUtils.isBlank(NO_WHITESPACE_FIXTURE);
        assertFalse(result);
    }
    
    public void testThatIsBlankReturnsFalseForStringWithSomeWhitespaceCharacters() {
        boolean result = StringUtils.isBlank(SOME_WHITESPACE_FIXTURE);
        assertFalse(result);
    }
    
    public void testThatIsBlankReturnsTrueForStringContainingOnlyWhitespaceCharacters() {
        boolean result = StringUtils.isBlank(ONLY_WHITESPACE_FIXTURE);
        assertTrue(result);
    }

    public void testThatIsNotWhitespaceReturnsTrueForNullString() {
        boolean result = StringUtils.isNotWhitespace(null);
        assertTrue(result);
    }
    
    public void testThatIsNotWhitespaceReturnsFalseForEmptyString() {
        boolean result = StringUtils.isNotWhitespace(StringUtils.EMPTY);
        assertFalse(result);
    }
    
    public void testThatIsNotWhitespaceReturnsTrueForStringWithNoWhitespaceCharacters() {
        boolean result = StringUtils.isNotWhitespace(NO_WHITESPACE_FIXTURE);
        assertTrue(result);
    }
    
    public void testThatIsNotWhitespaceReturnsTrueForStringWithSomeWhitespaceCharacters() {
        boolean result = StringUtils.isNotWhitespace(SOME_WHITESPACE_FIXTURE);
        assertTrue(result);
    }
    
    public void testThatIsNotWhitespaceReturnsFalseForStringContainingOnlyWhitespaceCharacters() {
        boolean result = StringUtils.isNotWhitespace(ONLY_WHITESPACE_FIXTURE);
        assertFalse(result);
    }
    
    public void testThatIsNotBlankReturnsFalseForNullString() {
        boolean result = StringUtils.isNotBlank(null);
        assertFalse(result);
    }
    
    public void testThatIsNotBlankReturnsFalseForEmptyString() {
        boolean result = StringUtils.isNotBlank(StringUtils.EMPTY);
        assertFalse(result);
    }
    
    public void testThatIsNotBlankReturnsTrueForStringWithNoWhitespaceCharacters() {
        boolean result = StringUtils.isNotBlank(NO_WHITESPACE_FIXTURE);
        assertTrue(result);
    }
    
    public void testThatIsNotBlankReturnsTrueForStringWithSomeWhitespaceCharacters() {
        boolean result = StringUtils.isNotBlank(SOME_WHITESPACE_FIXTURE);
        assertTrue(result);
    }
    
    public void testThatIsNotBlankReturnsFalseForStringContainingOnlyWhitespaceCharacters() {
        boolean result = StringUtils.isNotBlank(ONLY_WHITESPACE_FIXTURE);
        assertFalse(result);
    }
    
}
